package br.com.cnpv.modelo.dao;

import java.util.List;

import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;

import br.com.cnpv.modelo.acesso.idao.IMarcaDAO;
import br.com.cnpv.modelo.entity.Marca;

public class MarcaDAO implements IMarcaDAO{

	@SuppressWarnings("unchecked")
	@Override
	public List<Marca> listar(Session session) throws HibernateException 
	{
		Query query = session.getNamedQuery("Marca.listar");
		return query.list();
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<Marca> listarPorTipo(Integer idTipoVeiculo, Session session)
			throws HibernateException {
		Query query = session.getNamedQuery("Marca.listarPorTipo");
		query.setInteger("idTipoVeiculo", idTipoVeiculo);
		return query.list();
	}
}
